package com.sairobo.admin.modules.srblive.manager.impl;

import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import org.springframework.stereotype.Component;

import com.sairobo.base.common.entity.Page;
import com.sairobo.base.common.constant.QueryConts;
import com.sairobo.base.common.entity.Query;
import com.sairobo.admin.modules.srblive.dao.SrbliveUserDetailMapper;
import com.sairobo.admin.modules.srblive.entity.SrbliveUserDetail;
import com.sairobo.admin.modules.srblive.manager.SrbliveUserDetailManager;

/**
 * 知心云用户详情
 *
 * @author admin
 * @email sairobo
 * @url www.sairobo.com
 * @date 2018年1月11日 上午11:07:24
 */
@Component("srbliveUserDetailManager")
public class SrbliveUserDetailManagerImpl extends ServiceImpl<SrbliveUserDetailMapper,SrbliveUserDetail> implements SrbliveUserDetailManager {
    
	@Override
	public List<SrbliveUserDetail> listSrbliveUserDetail(Page<SrbliveUserDetail> page, Query search) {
        EntityWrapper<SrbliveUserDetail> ew=new EntityWrapper<SrbliveUserDetail>();
        Map map = (HashMap)search.get(QueryConts.SEARCH_KEYWORD);

//        ew.andNew();
//        ew.like("org_Name",(String) map.get("key"));
//        ew.or();
//        ew.like("act_Type",(String) map.get("key"));

        ew.orderBy("id",false);
        return baseMapper.selectPage(page,ew);
	}

	@Override
	public int saveSrbliveUserDetail(SrbliveUserDetail srbliveUserDetail) {
        return baseMapper.insert(srbliveUserDetail);
	}

	@Override
	public SrbliveUserDetail getSrbliveUserDetailById(Long id) {
        SrbliveUserDetail test = baseMapper.selectById(id);
        return test;
	}

	@Override
	public int updateSrbliveUserDetail(SrbliveUserDetail srbliveUserDetail) {
        return baseMapper.updateById(srbliveUserDetail);
	}

	@Override
	public int batchRemove(Long[] id) {
        int count = baseMapper.deleteBatchIds(Arrays.asList(id));
        return count;
	}
	
}
